
clear all
set more off, perm
capture log close
set maxvar 32767
global klmChinaReach2: env klmChinaReach2
global datapath "${klmChinaReach2}/Fuyao_Erlfang"

*****************Fine*****************
**# Fine


cd "$datapath\estimates\maturation\Graphs\f"
use f_add, clear
// replace var_ub_ = add_pe + 1.96*var_sd_
// replace var_lb_ = add_pe - 1.96*var_sd_

// replace var1 = subinstr(var1, "Level ", "", .)
// destring var1, replace
// rename level levelc2 
*kbar
preserve 
keep if var == "Kbar"
label var var_ub_ "95% CI"
label var add_pe "Minimum Skill Requirement"
twoway scatter add_pe level, sort msize(medsmall) || rcap var_ub_ var_lb_ level, sort lcolor(gs10) lwidth(medium) ///
	xlabel(1(1)7, labsize(small)) xmtick(, labsize(small)) ///
	xtitle(Difficulty Level, size(small)) ytitle(Kbar, size(small)) ylabel(,labsize(small)) ///
	title("Minimum Latent Fine Motor Skills Requirement by Level", size(medium)) subtitle(Additive Model w/ Scale Invariance, size(small)) legend(order(1 2 "95% CI") row(1) size(small) nobox fcolor() region(fcolor(white) margin(zero)) bmargin(zero) rowgap(tiny) colgap(tiny) keygap(tiny)) ///
	note("Note: The confidence interval is based on 1,000 iteration bootstrap." " The value at Level 1 is normalized to one.", size(small) span)   ///
	graphregion(fcolor(white) ifcolor(white) ilwidth(vvvthin)) plotregion(margin(medsmall) lwidth(vvvthin) ilwidth(vvvthin)) ///
	saving("add_kbar", replace)
	graph export "add_kbar.pdf", replace
restore


preserve 
keep if var != "Kbar" & var != "Delta"
label var var_ub_ "95% CI"
label var add_pe "{&sigma}{sup:2}({&epsilon},l)"
// foreach i in mul_pe var_lb_ var_ub_{
// 	replace `i' = ln(`i')
// }
replace var_lb_ = . if add_pe > 30
replace var_ub_ = . if add_pe > 30
replace add_pe = . if add_pe > 30

twoway scatter add_pe level, sort lwidth(medium) msize(medium) cmissing(n) || rcap var_ub_ var_lb_ level, sort lcolor(gs10) lwidth(medium) cmissing(n)  ///
	xlabel(2(1)7, labsize(small)) xmtick(, labsize(small)) ///
	xtitle(Difficulty Level, size(small)) ytitle("{&sigma}{sup:2}({&epsilon},l)", size(small)) ylabel(,labsize(small)) ///
	title("Variances of Task Shocks ({&sigma}{sup:2}({&epsilon},l)) by Level (Fine Motor)", size(medium)) subtitle(Additive Model w/ Scale Invariance, size(small)) legend(order(1 "{&sigma}{sup:2}({&epsilon},l)" 2 "95% CI") row(1) size(small) nobox fcolor() region(fcolor(white) margin(zero)) bmargin(zero) rowgap(tiny) colgap(tiny) keygap(tiny)) ///
	note("Note: The confidence interval is based on 1,000 iteration bootstrap." "Variances with values over 30 are dropped to better visualize the estimates for other levels," "and their confidence intervals are not shown." "Level 1 variance is normalized to one", size(small) span)   ///
	graphregion(fcolor(white) ifcolor(white) ilwidth(vvvthin)) plotregion(margin(medsmall) lwidth(vvvthin) ilwidth(vvvthin)) ///
	saving("add_sigma_30", replace)
	graph export "add_sigma_30.pdf", replace	
restore	
	
	
**log version
preserve 
keep if var != "Kbar" & var != "Delta"
label var var_ub_ "95% CI"
label var add_pe "{&sigma}{sup:2}({&epsilon},l)"
foreach i in add_pe var_lb_ var_ub_{
	replace `i' = ln(`i')
}
// replace var_lb_ = . if mul_pe > 30
// replace var_ub_ = . if mul_pe > 30
// replace mul_pe = . if mul_pe > 30

twoway scatter add_pe level, sort lwidth(medium) msize(medium) cmissing(n) || rcap var_ub_ var_lb_ level, sort lcolor(gs10) lwidth(medium) cmissing(n)  ///
	xlabel(2(1)7, labsize(small)) xmtick(, labsize(small)) ///
	xtitle(Difficulty Level, size(small)) ytitle("{&sigma}{sup:2}({&epsilon},l)", size(small)) ylabel(,labsize(small)) ///
	xtitle(Difficulty Level, size(small)) ytitle("log({&sigma}{sup:2}({&epsilon},l))", size(small)) ylabel(,labsize(small)) ///
	title("Log of Variances of Task Shocks ({&sigma}{sup:2}({&epsilon},l)) by Level (Fine Motor)", size(medium)) subtitle(Additive Model w/ Scale Invariance, size(small)) legend(order(1 "{&sigma}{sup:2}({&epsilon},l)" 2 "95% CI") row(1) size(small) nobox fcolor() region(fcolor(white) margin(zero)) bmargin(zero) rowgap(tiny) colgap(tiny) keygap(tiny)) ///
	note("Note: The confidence interval is based on 1,000 iteration bootstrap." "Log values are shown in the figure to better visualize values for all levels" "Level 1 variance is normalized to one", size(small) span)   ///
	graphregion(fcolor(white) ifcolor(white) ilwidth(vvvthin)) plotregion(margin(medsmall) lwidth(vvvthin) ilwidth(vvvthin)) ///
	saving("add_sigma", replace)
	graph export "add_sigma.pdf", replace	
restore	
	
	
	
	



**# fine_mul

use "f_mul", clear
// replace var_ub_ = mul_pe + 1.96*var_sd_
// replace var_lb_ = mul_pe - 1.96*var_sd_

// replace var1 = subinstr(var1, "Level ", "", .)
// destring var1, replace
// rename level levelc2 
*kbar
preserve 
keep if var == "Kbar"
label var var_ub_ "95% CI"
label var mul_pe "Minimum Skill Requirement"
twoway scatter mul_pe level, sort msize(medsmall) || rcap var_ub_ var_lb_ level, sort lcolor(gs10) lwidth(medium) ///
	xlabel(2(1)7, labsize(small)) xmtick(, labsize(small)) ///
	xtitle(Difficulty Level, size(small)) ytitle(Kbar, size(small)) ylabel(,labsize(small)) ///
	title("Minimum Latent Fine Motor Skills Requirement by Level", size(medium)) subtitle(Multiplicative Model w/ Scale Invariance, size(small)) legend(order(1 2 "95% CI") row(1) size(small) nobox fcolor() region(fcolor(white) margin(zero)) bmargin(zero) rowgap(tiny) colgap(tiny) keygap(tiny)) ///
	note("Note: The confidence interval is based on 1,000 iteration bootstrap." "The value at Level 1 is normalized to one.", size(small) span)   ///
	graphregion(fcolor(white) ifcolor(white) ilwidth(vvvthin)) plotregion(margin(medsmall) lwidth(vvvthin) ilwidth(vvvthin)) ///
	saving("mul_kbar", replace)
	graph export "mul_kbar.pdf", replace
restore

preserve 
keep if var != "Kbar" & var != "Delta"
label var var_ub_ "95% CI"
label var mul_pe "{&sigma}{sup:2}({&epsilon},l)"
// foreach i in mul_pe var_lb_ var_ub_{
// 	replace `i' = ln(`i')
// }
replace var_lb_ = . if mul_pe > 30
replace var_ub_ = . if mul_pe > 30
replace mul_pe = . if mul_pe > 30

twoway scatter mul_pe level, sort lwidth(medium) msize(medium) cmissing(n) || rcap var_ub_ var_lb_ level, sort lcolor(gs10) lwidth(medium) cmissing(n)  ///
	xlabel(2(1)7, labsize(small)) xmtick(, labsize(small)) ///
	xtitle(Difficulty Level, size(small)) ytitle("{&sigma}{sup:2}({&epsilon},l)", size(small)) ylabel(,labsize(small)) ///
	title("Variances of Task Shocks ({&sigma}{sup:2}({&epsilon},l)) by Level (Fine Motor)", size(medium)) subtitle(Multiplicative Model w/ Scale Invariance, size(small)) legend(order(1 "{&sigma}{sup:2}({&epsilon},l)" 2 "95% CI") row(1) size(small) nobox fcolor() region(fcolor(white) margin(zero)) bmargin(zero) rowgap(tiny) colgap(tiny) keygap(tiny)) ///
	note("Note: The confidence interval is based on 1,000 iteration bootstrap." "Variances with values over 30 are dropped to better visualize the estimates for other levels," "and their confidence intervals are not shown." "Level 1 variance is normalized to one", size(small) span)   ///
	graphregion(fcolor(white) ifcolor(white) ilwidth(vvvthin)) plotregion(margin(medsmall) lwidth(vvvthin) ilwidth(vvvthin)) ///
	saving("mul_sigma_30", replace)
	graph export "mul_sigma_30.pdf", replace	
restore	
	
	
**log version
preserve 
keep if var != "Kbar" & var != "Delta"
label var var_ub_ "95% CI"
label var mul_pe "{&sigma}{sup:2}({&epsilon},l)"
foreach i in mul_pe var_lb_ var_ub_{
	replace `i' = ln(`i')
}
// replace var_lb_ = . if mul_pe > 30
// replace var_ub_ = . if mul_pe > 30
// replace mul_pe = . if mul_pe > 30

twoway scatter mul_pe level, sort lwidth(medium) msize(medium) cmissing(n) || rcap var_ub_ var_lb_ level, sort lcolor(gs10) lwidth(medium) cmissing(n)  ///
	xlabel(2(1)7, labsize(small)) xmtick(, labsize(small)) ///
	xtitle(Difficulty Level, size(small)) ytitle("{&sigma}{sup:2}({&epsilon},l)", size(small)) ylabel(,labsize(small)) ///
	xtitle(Difficulty Level, size(small)) ytitle("log({&sigma}{sup:2}({&epsilon},l))", size(small)) ylabel(,labsize(small)) ///
	title("Log of Variances of Task Shocks ({&sigma}{sup:2}({&epsilon},l)) by Level (Fine Motor)", size(medium)) subtitle(Multiplicative Model w/ Scale Invariance, size(small)) legend(order(1 "{&sigma}{sup:2}({&epsilon},l)" 2 "95% CI") row(1) size(small) nobox fcolor() region(fcolor(white) margin(zero)) bmargin(zero) rowgap(tiny) colgap(tiny) keygap(tiny)) ///
	note("Note: The confidence interval is based on 1,000 iteration bootstrap." "Log values are shown in the figure to better visualize values for all levels" "Level 1 variance is normalized to one", size(small) span)   ///
	graphregion(fcolor(white) ifcolor(white) ilwidth(vvvthin)) plotregion(margin(medsmall) lwidth(vvvthin) ilwidth(vvvthin)) ///
	saving("mul_sigma", replace)
	graph export "mul_sigma.pdf", replace	
restore	


	

**# fine intercept

use "f_add_wo_si", clear

capture destring var_lb_ var_ub_, replace force
 
*kbar
preserve 
keep if var == "Kbar"
label var var_ub_ "95% CI"
label var add_pe "Minimum Skill Requirement"
twoway scatter add_pe level, sort msize(medsmall) || rcap var_ub_ var_lb_ level, sort lcolor(gs10) lwidth(medium) ///
	xlabel(1(1)7, labsize(small)) xmtick(, labsize(small)) ///
	xtitle(Difficulty Level, size(small)) ytitle(Kbar, size(small)) ylabel(,labsize(small)) ///
	title("Minimum Latent Fine Motor Skills Requirement by Level", size(medium)) subtitle(Additive Model w/ Scale Invariance, size(small)) legend(order(1 2 "95% CI") row(1) size(small) nobox fcolor() region(fcolor(white) margin(zero)) bmargin(zero) rowgap(tiny) colgap(tiny) keygap(tiny)) ///
	note("Note: The confidence interval is based on 1,000 iteration bootstrap." " The value at Level 1 is normalized to one.", size(small) span)   ///
	graphregion(fcolor(white) ifcolor(white) ilwidth(vvvthin)) plotregion(margin(medsmall) lwidth(vvvthin) ilwidth(vvvthin)) ///
	saving("add_kbar_wo", replace)
	graph export "add_kbar_wo.pdf", replace
restore


preserve 
keep if var != "Kbar" & var != "Delta"& var != "Beta1"
label var var_ub_ "95% CI"
label var add_pe "{&sigma}{sup:2}({&epsilon},l)"
// foreach i in mul_pe var_lb_ var_ub_{
// 	replace `i' = ln(`i')
// }
replace var_lb_ = . if add_pe > 30
replace var_ub_ = . if add_pe > 30
replace add_pe = . if add_pe > 30

twoway scatter add_pe level, sort lwidth(medium) msize(medium) cmissing(n) || rcap var_ub_ var_lb_ level, sort lcolor(gs10) lwidth(medium) cmissing(n)  ///
	xlabel(2(1)7, labsize(small)) xmtick(, labsize(small)) ///
	xtitle(Difficulty Level, size(small)) ytitle("{&sigma}{sup:2}({&epsilon},l)", size(small)) ylabel(,labsize(small)) ///
	title("Variances of Task Shocks ({&sigma}{sup:2}({&epsilon},l)) by Level (Fine Motor)", size(medium)) subtitle(Additive Model w/ Scale Invariance, size(small)) legend(order(1 "{&sigma}{sup:2}({&epsilon},l)" 2 "95% CI") row(1) size(small) nobox fcolor() region(fcolor(white) margin(zero)) bmargin(zero) rowgap(tiny) colgap(tiny) keygap(tiny)) ///
	note("Note: The confidence interval is based on 1,000 iteration bootstrap." "Variances with values over 30 are dropped to better visualize the estimates for other levels," "and their confidence intervals are not shown." "Level 1 variance is normalized to one", size(small) span)   ///
	graphregion(fcolor(white) ifcolor(white) ilwidth(vvvthin)) plotregion(margin(medsmall) lwidth(vvvthin) ilwidth(vvvthin)) ///
	saving("add_sigma_30_wo", replace)
	graph export "add_sigma_30_wo.pdf", replace	
restore	
	
	
**log version
preserve 
keep if var != "Kbar" & var != "Delta"& var != "Beta1"
label var var_ub_ "95% CI"
label var add_pe "{&sigma}{sup:2}({&epsilon},l)"
foreach i in add_pe var_lb_ var_ub_{
	replace `i' = ln(`i')
}
// replace var_lb_ = . if mul_pe > 30
// replace var_ub_ = . if mul_pe > 30
// replace mul_pe = . if mul_pe > 30

twoway scatter add_pe level, sort lwidth(medium) msize(medium) cmissing(n) || rcap var_ub_ var_lb_ level, sort lcolor(gs10) lwidth(medium) cmissing(n)  ///
	xlabel(2(1)7, labsize(small)) xmtick(, labsize(small)) ///
	xtitle(Difficulty Level, size(small)) ytitle("{&sigma}{sup:2}({&epsilon},l)", size(small)) ylabel(,labsize(small)) ///
	xtitle(Difficulty Level, size(small)) ytitle("log({&sigma}{sup:2}({&epsilon},l))", size(small)) ylabel(,labsize(small)) ///
	title("Log of Variances of Task Shocks ({&sigma}{sup:2}({&epsilon},l)) by Level (Fine Motor)", size(medium)) subtitle(Additive Model w/ Scale Invariance, size(small)) legend(order(1 "{&sigma}{sup:2}({&epsilon},l)" 2 "95% CI") row(1) size(small) nobox fcolor() region(fcolor(white) margin(zero)) bmargin(zero) rowgap(tiny) colgap(tiny) keygap(tiny)) ///
	note("Note: The confidence interval is based on 1,000 iteration bootstrap." "Log values are shown in the figure to better visualize values for all levels" "Level 1 variance is normalized to one", size(small) span)   ///
	graphregion(fcolor(white) ifcolor(white) ilwidth(vvvthin)) plotregion(margin(medsmall) lwidth(vvvthin) ilwidth(vvvthin)) ///
	saving("add_sigma_wo", replace)
	graph export "add_sigma_wo.pdf", replace	
restore	
	

preserve 
keep if var == "Beta1"
label var var_ub_ "95% CI"
label var add_pe "{&beta}{sub:1}"
twoway connected add_pe level, sort lwidth(medium) msize(medium) || line var_ub_ level, sort lcolor(gs11) lpattern(dash) lwidth(medium) || line var_lb_ level, sort lcolor(gs11) lpattern(dash) lwidth(medium)   ///
	xlabel(1(1)7, labsize(small)) xmtick(, labsize(small)) yline(1, lcolor(khaki) lwidth(medium)) ///
	xtitle(Difficulty Level, size(small)) ytitle("{&beta}{sub:1}", size(small)) ylabel(,labsize(small)) ///
	title("Transformation Function Slope ({&beta}{sub:1,l}) by Level (Fine Motor)", size(large)) subtitle(Additive Model w/o Scale Invariance, size(medium)) legend(order(1 2) row(1) size(small) nobox fcolor() region(fcolor(white) margin(zero)) bmargin(zero) rowgap(tiny) colgap(tiny) keygap(tiny)) ///
	note("Note: The confidence interval is based on 1,000 iteration bootstrap.", size(small) span)   ///
	graphregion(fcolor(white) ifcolor(white) ilwidth(vvvthin)) plotregion(margin(medsmall) lwidth(vvvthin) ilwidth(vvvthin)) ///
	saving("add_beta1", replace)
	graph export "add_beta1.pdf", replace
restore	

**# fine_mul_wo
	
	
use "f_mul_wo_si", clear
capture destring var_lb_ var_ub_, replace force
// replace var_ub_ = mul_pe + 1.96*var_sd_
// replace var_lb_ = mul_pe - 1.96*var_sd_
preserve 
keep if var == "Kbar"
label var var_ub_ "95% CI"
label var mul_pe "Minimum Skill Requirement"
twoway scatter mul_pe level, sort msize(medsmall) || rcap var_ub_ var_lb_ level, sort lcolor(gs10) lwidth(medium) ///
	xlabel(2(1)7, labsize(small)) xmtick(, labsize(small)) ///
	xtitle(Difficulty Level, size(small)) ytitle(Kbar, size(small)) ylabel(,labsize(small)) ///
	title("Minimum Latent Fine Motor Skills Requirement by Level", size(medium)) subtitle(Multiplicative Model w/ Scale Invariance, size(small)) legend(order(1 2 "95% CI") row(1) size(small) nobox fcolor() region(fcolor(white) margin(zero)) bmargin(zero) rowgap(tiny) colgap(tiny) keygap(tiny)) ///
	note("Note: The confidence interval is based on 1,000 iteration bootstrap." "The value at Level 1 is normalized to one.", size(small) span)   ///
	graphregion(fcolor(white) ifcolor(white) ilwidth(vvvthin)) plotregion(margin(medsmall) lwidth(vvvthin) ilwidth(vvvthin)) ///
	saving("mul_kbar_wo", replace)
	graph export "mul_kbar_wo.pdf", replace
restore

preserve 
keep if var != "Kbar" & var != "Delta"& var != "Beta1"
label var var_ub_ "95% CI"
label var mul_pe "{&sigma}{sup:2}({&epsilon},l)"
// foreach i in mul_pe var_lb_ var_ub_{
// 	replace `i' = ln(`i')
// }
replace var_lb_ = . if mul_pe > 30
replace var_ub_ = . if mul_pe > 30
replace mul_pe = . if mul_pe > 30

twoway scatter mul_pe level, sort lwidth(medium) msize(medium) cmissing(n) || rcap var_ub_ var_lb_ level, sort lcolor(gs10) lwidth(medium) cmissing(n)  ///
	xlabel(2(1)7, labsize(small)) xmtick(, labsize(small)) ///
	xtitle(Difficulty Level, size(small)) ytitle("{&sigma}{sup:2}({&epsilon},l)", size(small)) ylabel(,labsize(small)) ///
	title("Variances of Task Shocks ({&sigma}{sup:2}({&epsilon},l)) by Level (Fine Motor)", size(medium)) subtitle(Multiplicative Model w/ Scale Invariance, size(small)) legend(order(1 "{&sigma}{sup:2}({&epsilon},l)" 2 "95% CI") row(1) size(small) nobox fcolor() region(fcolor(white) margin(zero)) bmargin(zero) rowgap(tiny) colgap(tiny) keygap(tiny)) ///
	note("Note: The confidence interval is based on 1,000 iteration bootstrap." "Variances with values over 30 are dropped to better visualize the estimates for other levels," "and their confidence intervals are not shown." "Level 1 variance is normalized to one", size(small) span)   ///
	graphregion(fcolor(white) ifcolor(white) ilwidth(vvvthin)) plotregion(margin(medsmall) lwidth(vvvthin) ilwidth(vvvthin)) ///
	saving("mul_sigma_30_wo", replace)
	graph export "mul_sigma_30_wo.pdf", replace	
restore	
	
	
**log version
preserve 
keep if var != "Kbar" & var != "Delta"& var != "Beta1"
label var var_ub_ "95% CI"
label var mul_pe "{&sigma}{sup:2}({&epsilon},l)"
foreach i in mul_pe var_lb_ var_ub_{
	replace `i' = ln(`i')
}
// replace var_lb_ = . if mul_pe > 30
// replace var_ub_ = . if mul_pe > 30
// replace mul_pe = . if mul_pe > 30

twoway scatter mul_pe level, sort lwidth(medium) msize(medium) cmissing(n) || rcap var_ub_ var_lb_ level, sort lcolor(gs10) lwidth(medium) cmissing(n)  ///
	xlabel(2(1)7, labsize(small)) xmtick(, labsize(small)) ///
	xtitle(Difficulty Level, size(small)) ytitle("{&sigma}{sup:2}({&epsilon},l)", size(small)) ylabel(,labsize(small)) ///
	xtitle(Difficulty Level, size(small)) ytitle("log({&sigma}{sup:2}({&epsilon},l))", size(small)) ylabel(,labsize(small)) ///
	title("Log of Variances of Task Shocks ({&sigma}{sup:2}({&epsilon},l)) by Level (Fine Motor)", size(medium)) subtitle(Multiplicative Model w/ Scale Invariance, size(small)) legend(order(1 "{&sigma}{sup:2}({&epsilon},l)" 2 "95% CI") row(1) size(small) nobox fcolor() region(fcolor(white) margin(zero)) bmargin(zero) rowgap(tiny) colgap(tiny) keygap(tiny)) ///
	note("Note: The confidence interval is based on 1,000 iteration bootstrap." "Log values are shown in the figure to better visualize values for all levels" "Level 1 variance is normalized to one", size(small) span)   ///
	graphregion(fcolor(white) ifcolor(white) ilwidth(vvvthin)) plotregion(margin(medsmall) lwidth(vvvthin) ilwidth(vvvthin)) ///
	saving("mul_sigma_wo", replace)
	graph export "mul_sigma_wo.pdf", replace	
restore	

preserve 
 replace var_ub_ = mul_pe + 1.96*var_sd_
 replace var_lb_ = mul_pe - 1.96*var_sd_

keep if var == "Beta1"
label var var_ub_ "95% CI"
label var mul_pe "{&gamma}{sub:1,l}"
twoway connected mul_pe level, sort lwidth(medium) msize(medium) || line var_ub_ level, sort lcolor(gs11) lpattern(dash) lwidth(medium) || line var_lb_ level, sort lcolor(gs11) lpattern(dash) lwidth(medium)   ///
	xlabel(1(1)7, labsize(small)) xmtick(, labsize(small)) yline(1, lcolor(khaki) lwidth(medium)) ///
	xtitle(Difficulty Level, size(small)) ytitle("{&gamma}{sub:1,l}", size(small)) ylabel(,labsize(small)) ///
	title("Transformation Function Slope ({&gamma}{sub:1,l}) by Level (Fine Motor)", size(large)) subtitle(Multiplicative Model w/o Scale Invariance, size(medium)) legend(order(1 2) row(1) size(small) nobox fcolor() region(fcolor(white) margin(zero)) bmargin(zero) rowgap(tiny) colgap(tiny) keygap(tiny)) ///
	note("Note: The confidence interval is based on standard error.", size(small) span)   ///
	graphregion(fcolor(white) ifcolor(white) ilwidth(vvvthin)) plotregion(margin(medsmall) lwidth(vvvthin) ilwidth(vvvthin)) ///
	saving("mul_beta1_sd", replace)
	graph export "mul_beta1_sd.pdf", replace
restore	



**# fine_deltaeta


use eta_delta_f_add, clear


label var m_eta_1_ "Fast"
label var m_eta_2_ "Normal"
label var m_eta_3_ "Slow"
label var ul_1_ "95% CI"
twoway connected m_eta_1_ level, sort lwidth(medthick) msize(medium) mc(navy) lcolor(navy) lpattern(dash)|| rcap ul_1_ ll_1_ level, sort lcolor(gs12) lwidth(medthick) || connected m_eta_2_ level, sort msize(medium) m(S) mc(olive) lcolor(olive)  lpattern(dash) || rcap ul_2_ ll_2_ level, sort lcolor(gs12) lwidth(medthick) || connected m_eta_3_ level, sort msize(medium) m(T) mc(orange) lcolor(orange)  lpattern(dash) || rcap ul_3_ ll_3_ level, sort lcolor(gs12) lwidth(medthick)  ///
	xlabel(3(1)7, labsize(small)) xmtick(, labsize(small)) ///
	xtitle(Difficulty Level, size(small)) ytitle({&delta}(l)E({&eta}), size(small)) ylabel(,labsize(small)) ///
	title(Learning Component ({&delta}(l)E({&eta})) by Difficulty Level (Fine Motor), size(med)) subtitle(by Ability Group, size(medsmall)) legend(order(1 3 5 2 "95% CI") row(1) size(vsmall) nobox fcolor() region(fcolor(white) margin(zero)) bmargin(zero) rowgap(tiny) colgap(tiny) keygap(tiny)) ///
	note("1. Fast group: the child can pass the first task at over 80% of the difficulty levels, and the average pass rate at that level is greater than 80%." "Normal group: the child doesn't pass the first task, and the pass rate is greater than 50%; or the child passes the first task, and the pass rate is" "between 50% and 80%. Slow group: the average pass rate is less than 50%.    2. 95% confidence intervals are shown for three groups." "3. Values of {&Delta} for level 1 and 2 are normalized to one.", size(vsmall) span) ///
	graphregion(fcolor(white) ifcolor(white) ilwidth(vvvthin)) plotregion(margin(medsmall) lwidth(vvvthin) ilwidth(vvvthin)) ///
	saving("add_deltaeta", replace)
	graph export "add_deltaeta.pdf", replace	
	
	
use eta_delta_f_mul, clear


label var m_eta_1_ "Fast"
label var m_eta_2_ "Normal"
label var m_eta_3_ "Slow"
label var ul_1_ "95% CI"

// twoway scatter m_eta_1_ level, sort lwidth(medthick) msize(medium) mc(navy) lcolor(navy) lpattern(dash)|| rcap ul_1_ ll_1_ level, sort lcolor(gs12) lwidth(medthick) || scatter m_eta_2_ level, sort msize(medium) m(S) mc(olive) lcolor(olive)  lpattern(dash) || rcap ul_2_ ll_2_ level, sort lcolor(gs12) lwidth(medthick) || scatter m_eta_3_ level, sort msize(medium) m(T) mc(orange) lcolor(orange)  lpattern(dash) || rcap ul_3_ ll_3_ level, sort lcolor(gs12) lwidth(medthick)  ///
twoway connected m_eta_1_ level, sort lwidth(medthick) msize(medium) mc(navy) lcolor(navy) lpattern(dash)|| rcap ul_1_ ll_1_ level, sort lcolor(gs12) lwidth(medthick) || connected m_eta_2_ level, sort msize(medium) m(S) mc(olive) lcolor(olive)  lpattern(dash) || rcap ul_2_ ll_2_ level, sort lcolor(gs12) lwidth(medthick) || connected m_eta_3_ level, sort msize(medium) m(T) mc(orange) lcolor(orange)  lpattern(dash) || rcap ul_3_ ll_3_ level, sort lcolor(gs12) lwidth(medthick)  ///	
	xlabel(3(1)7, labsize(small)) xmtick(, labsize(small)) ///
	xtitle(Difficulty Level, size(small)) ytitle({&delta}(l)E({&eta}), size(small)) ylabel(,labsize(small)) ///
	title(Learning Component ({&delta}(l)E({&eta})) by Difficulty Level (Fine Motor), size(med)) subtitle(by Ability Group, size(medsmall)) legend(order(1 3 5 2 "95% CI") row(1) size(vsmall) nobox fcolor() region(fcolor(white) margin(zero)) bmargin(zero) rowgap(tiny) colgap(tiny) keygap(tiny)) ///
	note("1. Fast group: the child can pass the first task at over 80% of the difficulty levels, and the average pass rate at that level is greater than 80%." "Normal group: the child doesn't pass the first task, and the pass rate is greater than 50%; or the child passes the first task, and the pass rate is" "between 50% and 80%. Slow group: the average pass rate is less than 50%.    2. 95% confidence intervals are shown for three groups." "3. Values of {&Delta} for level 1 and 2 are normalized to one.", size(vsmall) span) ///
	graphregion(fcolor(white) ifcolor(white) ilwidth(vvvthin)) plotregion(margin(medsmall) lwidth(vvvthin) ilwidth(vvvthin)) ///
	saving("mul_deltaeta", replace)
	graph export "mul_deltaeta.pdf", replace	
